home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / ghostscr / ghostscr.zip / LANGUAGE.DOC < prev    next >
Text File  |  1993-08-03  |  16KB  |  421 lines

  1.    Copyright (C) 1989-1992 Aladdin Enterprises.  All rights reserved.
  2.  
  3. This file is part of Ghostscript.
  4.  
  5. Ghostscript is distributed in the hope that it will be useful, but
  6. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  7. to anyone for the consequences of using it or for whether it serves any
  8. particular purpose or works at all, unless he says so in writing.  Refer
  9. to the Ghostscript General Public License for full details.
  10.  
  11. Everyone is granted permission to copy, modify and redistribute
  12. Ghostscript, but only under the conditions described in the Ghostscript
  13. General Public License.  A copy of this license is supposed to have been
  14. given to you along with Ghostscript so you can know your rights and
  15. responsibilities.  It should be in a file named COPYING.  Among other
  16. things, the copyright notice and this notice must be preserved on all
  17. copies.
  18.  
  19. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  20.  
  21. This file, language.doc, describes the Ghostscript language.
  22.  
  23. For an overview of Ghostscript and a list of the documentation files, see
  24. README.
  25.  
  26. The Ghostscript interpreter, except as noted below, is intended to execute
  27. properly any source program written in a language defined by reference to
  28. the December 1990 printing of the PostScript Language Reference Manual
  29. (Second Edition) published by Addison-Wesley (ISBN 0-201-18127-4).  The
  30. Ghostscript language includes the following elements of the PostScript
  31. (TM) language:
  32.  
  33.     - The full PostScript Level 1 language, as also defined in the
  34. first edition of the PostScript Language Reference Manual, ISBN
  35. 0-201-10174-2, Addison-Wesley, 1985.
  36.  
  37.     - The CMYK color, file system, version 25.0 language, and
  38. miscellaneous additions listed in sections A.1.4, A.1.6, A.1.7, and
  39. A.1.8 of the Second Edition respectively, including allowing a string
  40. operand for the 'status' operator;
  41.  
  42.     - The Display PostScript extensions listed in section A.1.3
  43. of the Second Edition, but excluding the operators listed in section
  44. A.1.2.  These facilities are only available if the dps feature or the
  45. level2 feature was selected at the time that Ghostscript was compiled
  46. and linked.
  47.  
  48.     - The composite font extensions listed in section A.1.5 of
  49. the Second Edition, but not the ability to handle Type 0 fonts.
  50. These facilities are only available if the compfont feature or the
  51. level2 feature was selected at the time that Ghostscript was compiled
  52. and linked.
  53.  
  54.     - A subset of the other PostScript Level 2 operators and
  55. facilities listed in section A.1.1 of the Second Edition, identified
  56. below.  These facilities are only available if the level2 feature was
  57. selected at the time that Ghostscript was compiled and linked.
  58.  
  59. Ghostscript also includes a number of operators defined below that are not
  60. in the PostScript language.
  61.  
  62. Stub facilities
  63. ---------------
  64.  
  65. The following operators, while provided in the current release, have only
  66. a partial or dummy implementation.
  67.  
  68. Form and pattern operators:
  69.     execform
  70.  
  71. Graphics state operators:
  72.     currentblackgeneration, currentcolorscreen,
  73.     currenthalftonephase, currentundercolorremoval,
  74.     setblackgeneration, setcolorscreen,
  75.     sethalftonephase, setundercolorremoval,
  76.     currenthalftone, sethalftone
  77.  
  78. Interpreter parameter operators:
  79.     currentsystemparams, currentuserparams
  80.     setsystemparams, setucacheparams, setuserparams
  81.     ucachestatus
  82.  
  83. Path construction operators:
  84.     ucache
  85.  
  86. Virtual memory operators:
  87.     currentshared, scheck, setshared, setvmthreshold, shareddict,
  88.     SharedFontDirectory, vmreclaim
  89.  
  90. Miscellaneous operators:
  91.     serialnumber
  92.  
  93. Unclassified Level 2 operators
  94. ------------------------------
  95.  
  96. Ghostscript provides the following PostScript Level 2 operators
  97. listed in section A.1.1 of the Second Edition and not listed in any
  98. of the other A.1 sections.
  99.  
  100. File operators:
  101.        filter (all but DCTEncode/Decode)
  102.  
  103. Resource operators:
  104.     defineresource, findresource, resourceforall, resourcestatus,
  105.     undefineresource
  106.  
  107. Character and font operators:
  108.     cshow, xshow, yshow, xyshow
  109.     glyphshow
  110.     findencoding, rootfont, setcachedevice2
  111.       (WMode is supported, but composite fonts are not)
  112.  
  113. Graphics state operators:
  114.     currentcolor, currentcolorspace, setcolor, setcolorspace
  115.       (except for Indexed with procedure, true Separation, and Pattern)
  116.     currentcolorrendering, setcolorrendering
  117.  
  118. Miscellaneous operators:
  119.     languagelevel
  120.  
  121. In addition, Ghostscript supports the following Level 2 facilities:
  122.  
  123.     - Use of a dictionary with the image and imagemask operators;
  124.  
  125.     - Use of a string or a file as data source with the image,
  126.     imagemask, and colorimage operators.
  127.  
  128. When the Level 2 features are present, Ghostscript also supports the
  129. following operator:
  130.  
  131.     <1 or 2> .setlanguagelevel -
  132.         Set the current language level to Level 1 or Level 2.
  133.           When the language level is 1, no Level 2 facilities
  134.           are provided.
  135.  
  136. Unimplemented Level 2 facilities
  137. --------------------------------
  138.  
  139. Ghostscript currently does not implement the following Level 2
  140. operators and variables:
  141.     currentdevparams, setdevparams
  142.     GlobalFontDirectory
  143.     makepattern
  144.     realtime
  145.     currentpagedevice, setpagedevice
  146.     startjob
  147.  
  148. Ghostscript currently does not implement the following Level 2
  149. facilities not enumerated above:
  150.     garbage collection
  151.     global and local VM
  152.     page devices
  153.     job control
  154.     halftone dictionaries
  155.     user names
  156.  
  157. Ghostscript-specific additions
  158. ==============================
  159.  
  160. Miscellaneous
  161. -------------
  162.  
  163. ^Z is counted as whitespace.
  164.  
  165. run can take either a string or a file as its argument.  In the former
  166. case, it uses findlibfile to open the file (searching directories as
  167. needed).  In the latter case, it just runs the file, closing it at the
  168. end, and trapping errors just as for the string case.
  169.  
  170. Mathematical operators
  171. ----------------------
  172.  
  173.     <number> arccos <number>
  174.         Computes the arc cosine of a number between -1 and 1.
  175.  
  176.     <number> arcsin <number>
  177.         Computes the arc sine of a number between -1 and 1.
  178.  
  179. String operators
  180. ----------------
  181.  
  182.     <state> <fromString> <toString> type1encrypt <newState> <toSubstring>
  183.         Encrypts fromString according to the algorithm for Adobe
  184.           Type 1 fonts, writing the result into toString.
  185.           toString must be at least as long as fromString or a
  186.           rangecheck error occurs.  state is the initial state of
  187.           the encryption algorithm (a 16-bit non-negative
  188.           integer); newState is the new state of the algorithm.
  189.  
  190.     <state> <fromString> <toString> type1decrypt <newState> <toSubstring>
  191.         Decrypts fromString according to the algorithm for Adobe
  192.           Type 1 fonts, writing the result into toString.  Other
  193.           specifications are as for type1encrypt.
  194.  
  195. Relational operators
  196. --------------------
  197.  
  198.     <number|string> <number|string> max <number|string>
  199.         Returns the larger of two numbers or strings.
  200.  
  201.     <number|string> <number|string> min <number|string>
  202.         Returns the smaller of two numbers or strings.
  203.  
  204. File operators
  205. --------------
  206.  
  207.     <string> findlibfile <foundstring> <file> true or <string> false
  208.         Opens the file of the given name for reading.  If the file
  209.           cannot be opened using the supplied name, searches
  210.           through directories as described in use.doc.  If the
  211.           search fails, findlibfile simply pushes false on the
  212.           stack and returns, rather than causing an error.
  213.  
  214.     <file> <integer> unread -
  215.          Pushes back the last-read character onto the front of the
  216.           file.  If the file is only open for writing, or if the
  217.           integer argument is not the same as the last character
  218.           read from the file, causes an ioerror error.  May also
  219.           cause an ioerror if the last operation on the file was not
  220.           a reading operation.
  221.  
  222.     <file> <device> writeppmfile -
  223.         Writes the contents of the device, which must be an image
  224.           device, onto the file, in Portable PixMap (ppm) format.
  225.           Does not close the file.
  226.  
  227. Path operators
  228. --------------
  229.  
  230.     <x> <y> <width> <height> rectappend -
  231.     <numarray> rectappend -
  232.     <numstring> rectappend -
  233.         Appends a rectangle or rectangles to the current path, in
  234.           the same manner as rectfill, rectclip, etc.  Only
  235.           defined if the dps option is selected.
  236.  
  237. Filters
  238. -------
  239.  
  240. Ghostscript supports all standard filters except DCTEncode and
  241. DCTDecode.  Ghostscript does not support the use of a procedure as a
  242. data source or sink, only a file or a string.  In addition,
  243. Ghostscript supports two non-standard filters:
  244.  
  245.     <file|string> <seed_integer> /eexecDecode filter <file>
  246.         Creates a filter for decrypting data that has been
  247.           encrypted using eexec encryption as described in the
  248.           Adobe Type 1 Font Format documentation.  The
  249.           seed_integer must be 55665 for proper operation.
  250.  
  251.     <file|string> <hex_boolean> /PFBDecode filter <file>
  252.         Creates a filter that decodes data in .PFB format, the
  253.           usual semi-binary representation for Type 1 font files
  254.           on IBM PC and compatible systems.  If hex_boolean is true,
  255.           binary packets are converted to hex; if false, binary
  256.           packets are not converted.
  257.  
  258. Miscellaneous operators
  259. -----------------------
  260.  
  261.     - currenttime <number>
  262.         Returns the current value of a continuously-running timer,
  263.           in minutes.  The initial value of this timer is undefined.
  264.  
  265.     <string> getenv   <string> true  or  false
  266.         Looks up a name in the shell environment.  If the name is
  267.           found, returns the corresponding value and true; if the
  268.           name is not found, returns false.
  269.  
  270.     <name> <array> makeoperator <operator>
  271.         Constructs and returns a new operator that is actually the
  272.           given procedure in disguise.  The name is only used for
  273.           printing.  The operator has the executable attribute.
  274.  
  275.     <string> <boolean> setdebug -
  276.         If the Ghostscript interpreter was built with the DEBUG
  277.           flag set, sets or resets any subset of the debugging
  278.           flags normally controlled by -Z in the command line.
  279.           Has no effect otherwise.
  280.  
  281.     - oserrno <errno>
  282.         Returns the error code for the most recent OS error.
  283.  
  284.     - oserror <string>
  285.         Returns the error string for the most recent OS error.
  286.  
  287. Device operators
  288. ----------------
  289.  
  290.     <device> copydevice <device>
  291.         Copies a device.
  292.  
  293.     <index> getdevice <device>
  294.         Returns a device from the set of devices known to the
  295.           system.  The first device, which is default, is numbered
  296.           0.  If the index is out of range, causes a rangecheck
  297.           error.
  298.  
  299.     <matrix> <width> <height> <palette> makeimagedevice <device>
  300.         Makes a new device that accumulates an image in memory.
  301.           matrix is the initial transformation matrix: it must be
  302.           orthogonal (i.e., [a 0 0 b x y] or [0 a b 0 x y]).
  303.           palette is a string of 2^N or 3*2^N elements, specifying
  304.           how the 2^N possible pixel values will be interpreted.
  305.           Each element is interpreted as a gray value, or as RGB
  306.           values, multiplied by 255.  For example, if you want
  307.           a monochrome image for which 0=white and 1=black, the
  308.           palette should be <ff 00>; if you want a 3-bit deep
  309.           image with just the primary colors and their complements
  310.           (ignoring the fact that 3-bit images are not supported),
  311.           the palette might be <000000 0000ff 00ff00 00ffff
  312.           ff0000 ff00ff ffff00 ffffff>.  At present, the palette
  313.           must contain exactly 2, 4, 16, or 256 entries,
  314.           and must contain an entry for black and an entry
  315.           for white; if it contains any entries that aren't black,
  316.           white, or gray, it must contain at least the six primary
  317.           colors (red, green, blue, and their complements cyan,
  318.           magenta, and yellow); aside from this, its contents are
  319.           arbitrary.
  320.         Alternatively, palette can be null.  This is interpreted
  321.           as 24-bit-per-pixel color, where the four bytes of each
  322.           pixel are respectively R, G, and B.
  323.         Note that one can also make an image device (with the same
  324.           palette as an existing image device) by copying a device
  325.           using the copydevice operator.
  326.  
  327.     <device> <index> <string> copyscanlines <substring>
  328.         Copies one or more scan lines from an image device into a
  329.           string, starting at a given scan line in the image.
  330.           The data is in the same format as for the image
  331.           operator.  Error if the device is not an image device or
  332.           if the string is too small to hold at least one complete
  333.           scan line.  Always copies an integral number of scan
  334.           lines.
  335.  
  336.     <device> setdevice -
  337.         Sets the current device to the specified device.  Also
  338.           resets the transformation and clipping path to the
  339.           initial values for the device.
  340.  
  341.     - currentdevice <device>
  342.         Gets the current device from the graphics state.
  343.  
  344.     <device> devicename <string>
  345.         Gets the name of a device.
  346.  
  347.     <device> <matrix> deviceinitialmatrix <matrix>
  348.         Gets the initial matrix of a device, i.e., the one that
  349.           defaultmatrix would return if the device were the
  350.           current device.
  351.  
  352.     <device> getdeviceprops <mark> <name1> <value1> ... <namen> <valuen>
  353.         Gets all the properties of a device.  Currently defined
  354.           names and values for all devices are:
  355.             HWResolution [<float> <float>]
  356.                 X and Y resolution in pixels/inch.
  357.             HWSize [<integer> <integer>]
  358.                 X and Y size in pixels.
  359.             InitialMatrix [<6 floats>]
  360.                 Initial transformation matrix.
  361.             Name <string>
  362.                 Read-only.  The device name.
  363.         For printers, the following are also defined:
  364.             BufferSpace <integer>
  365.                 Buffer space for band lists, if the bitmap
  366.                   is too big to fit in RAM.
  367.             MaxBitmap <integer>
  368.                 Maximum space for a full bitmap in RAM.
  369.             OutputFile <string>
  370.                 () means send to printer directly,
  371.                   otherwise specifies the file name for
  372.                   output; a %d is replaced by the page #;
  373.                   on Unix systems, (|command) writes to a pipe
  374.             PageCount <integer>
  375.                 Read-only.  Counts the number of pages
  376.                   printed on the device.
  377.  
  378.     <mark> <name1> <value1> ... <namen> <valuen> <device>
  379.         putdeviceprops <device>
  380.         Sets properties of a device.  May cause undefined,
  381.           typecheck, rangecheck, or limitcheck errors.
  382.  
  383.     - flushpage -
  384.         On displays, flushes any buffered output, so that it
  385.           is guaranteed to show up on the screen; on printers,
  386.           has no effect.
  387.  
  388. Character operators
  389. -------------------
  390.  
  391.     <string> .type1addpath -
  392.     <string> <lsbx> <lsby> .type1addpath -
  393.         Adds the description of a character to the current
  394.           path.  The string argument is a scalable
  395.           description encoded in Adobe Type 1 format.  This
  396.           operator, like setcharwidth and setcachedevice, is
  397.           only valid in the context of a show operator.  It
  398.           uses information from the current font, in addition
  399.           to the argument(s).
  400.         The optional lsbx and lsby arguments are left side
  401.           bearing values that override the ones in the
  402.           character outline.
  403.  
  404.     <font> <char> Type1BuildChar -
  405.         This is not a new operator: rather, it is a name known
  406.           specially to the interpreter.  Whenever the interpreter
  407.           needs to render a character (during a ...show,
  408.           stringwidth, or charpath), it looks up the name
  409.           BuildChar in the font dictionary to find a procedure to
  410.           run.  If it does not find this name, and if the FontType
  411.           is 1, the interpreter instead uses the value (looked up
  412.           on the dictionary stack in the usual way) of the name
  413.           Type1BuildChar.
  414.         The standard definition of Type1BuildChar is in gs_fonts.ps.
  415.           Users should not need to redefine Type1BuildChar, except
  416.           perhaps for tracing or debugging.
  417.  
  418. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  419.  
  420. PostScript is a trademark of Adobe Systems, Incorporated.
  421.